<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../JS/vue.js"></script>
</head>
<body>
    <div id="app">
        <div @click="divClick">aaa
            <!-- 1. stop阻止冒泡 -->
        <button @click.stop="btnClick">按钮</button>
        </div>
        <!-- 2. .prevent修饰符作用 去除默认的跳转 -->
         <br>
         <form action="baidu">
            <input type="submit" value="提交" @click.prevent="submitClick">
         </form>
        <!-- 3.监听某个键盘的键帽 -->
         <input type="text" @keyup.enter="keyUp">
    </div>
    <script>
        const app = new Vue({
            el: '#app',
            data:{
                message: '你好'
            },
            methods:{
                btnClick(){
                    console.log('btnClick');
                },
                divClick(){
                    console.log('divClick');
                },
                submitClick(){
                    console.log('submitClick');
                },
                keyUp(){
                    console.log('keyUp');
                }
            }
        })
    </script>
</body>
</html>